﻿using SDF.Core.Infrastructure;
using SDF.Plugin.Misc.SAPAdapter.Models;
using SDF.Plugin.Misc.SAPAdapter.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SDF.Plugin.Misc.SAPAdapter.Extensions;

namespace SDF.Plugin.Misc.SAPAdapter.Controllers.Version1
{
    public class SAPInstanceController : SAPWebApiBase
    {
        private readonly ISAPInstanceService _sapInstanceService;

        public SAPInstanceController()
        {
            _sapInstanceService = EngineContext.Current.Resolve<ISAPInstanceService>();
        }

        public IEnumerable<QuerySAPInstanceModel> Get()
        {
            return _sapInstanceService.GetAllInstance().Select(p => p.ToQueryModel());
        }

        public IEnumerable<QuerySAPInstanceModel> Post()
        {
            return _sapInstanceService.GetAllInstance().Select(p => p.ToQueryModel());
        }
    }
}